home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CDSupport / CUCDSearch < prev    next >
Text File  |  1998-07-17  |  4KB  |  151 lines

  1. /*
  2. ** $VER: CUCDSearch v1.0 (18/07/98)
  3. **
  4. ** Written by Dave Stroud <Dave@newt.u-net.com>
  5. **
  6. ** READ "CUCDSearch.readme" FOR MORE INFO.
  7. */
  8.  
  9. /*
  10. ** SET THE VARIABLES BELOW FOR YOUR SYSTEM -------------------------------------
  11. */
  12.  
  13. /*
  14. ** Path to CUCD index files, including trailing slash or colon!
  15. */
  16. _CUCDIndices = ":CDSupport/indices/"
  17.  
  18. /*
  19. ** Path to "FlashFind" (the search tool used) INCLUDING "FlashFind" itself!
  20. */
  21. _FFPath = "FlashFind"
  22.  
  23. /*
  24. ** File to write results of search to.
  25. ** Recommended you keep this in Ram: for safety :-)
  26. */
  27. _SearchOut = "Ram:CUCDsearchresults.txt"
  28.  
  29. /*
  30. ** Viewer (path and command name) to show final results.
  31. ** Default "Sys:Utilities/Multiview" should suffice :-)
  32. */
  33. _viewcmd = ":Utilities/Multiview"
  34.  
  35. /*
  36. ** DO NOT EDIT BELOW THIS LINE! ------------------------------------------------
  37. */
  38.  
  39. options results
  40.  
  41. NL = '0a'x
  42. call addlib("Libs:rexxreqtools.library", 0, -30, 0)
  43.  
  44. _def1="rtez_flags=ezreqf_centertext"
  45. _def2="rtfi_flags=freqf_multiselect rtfi_matchpat=CD#?"
  46.  
  47. _welcomestring = "CUCDSearch" || NL || NL || "Search *only* the CUCDs you want to!" || NL || NL || "Written by Dave Stroud - July 1998"
  48. _nohitsstring="Sorry! No match found!"
  49. _selectstring = "Please choose which CUCD index file(s) to search..."
  50.  
  51. _OutFile = "RAM:CUCD_SearchResults."
  52. _hits = 0
  53.  
  54. if rtezrequest(_welcomestring, "Go on then|Oops, I clicked the wrong icon", "CUCDSearch!", _def1) = 0 then do
  55.  exit(0)
  56.  end
  57. else do
  58.  if length(rtfilerequest(_CUCDIndices,,"Select CUCD index file(s) to search:",,_def2,_files)) = 0 then do
  59.   exit(0)
  60.   end
  61.  else do
  62.   if _files.count = 0 then do
  63.    exit(0)
  64.    end
  65.   else do
  66.    _searchstring=rtgetstring(,"About to start searching "||_files.count||" CUCD index file(s)."||NL||"Please enter a search keyword:","Ready, Steady, Cook!","_Start Search|_Abort","rtgs_flags=gsreqf_centertext",_result)
  67.    if _result = 0 then do
  68.     rtezrequest("How dare you lead me on like that!", "Bite me", "Aiee!", _def1)
  69.     exit(0)
  70.     end
  71.    if length(_searchstring) < 2 then do
  72.     exit(0)
  73.     end
  74.    else do
  75.  
  76.  
  77.     _n=1
  78.     call time(r)
  79.     do until _n>_files.count
  80.      address command
  81.      _FFpath||' FROM "'||_files._n||'" SEARCH "'||_searchstring||'" QUIET CASESENSITIVE NOPREFS >'||_Outfile||_n
  82.      _n=_n+1
  83.      call close(_OutFile)
  84.      end
  85.     _n=1
  86.  
  87.     if ~open(_OUTPUT,_SearchOut,'W') then do
  88.      say "ERROR: Couldn't open output file for assembling results"
  89.      exit(0)
  90.      end
  91.  
  92.     else do
  93.      do until (_n > _files.count)
  94.       _SearchIn=_OutFile||_n
  95.       if ~open(_INPUT,_SearchIn,'R') then do
  96.        say "ERROR: Couldn't open individual results output file"
  97.        exit(0)
  98.        end
  99.       else do
  100.        _CDnum=RIGHT(_files._n,2)
  101.        call writeln(_OUTPUT," ")
  102.        call writeln(_OUTPUT,"--------------------------------------------------------------------------------")
  103.        call writeln(_OUTPUT,"CUCDSearch: Search results for CUCD"||_CDnum||":")
  104.        call writeln(_OUTPUT,"--------------------------------------------------------------------------------")
  105.        call writeln(_OUTPUT," ")
  106.        do until EOF(_INPUT)
  107.         _NextLine=Readln(_INPUT)
  108.         if length(_NextLine) > 0 then do
  109.          call writeln(_OUTPUT,_NextLine)
  110.          _hits = _hits + 1
  111.          end
  112.         end
  113.        end
  114.       _n=_n+1
  115.       call close(_INPUT)
  116.       address command
  117.       'Sys:c/delete "'||_SearchIn||'" FORCE QUIET'
  118.       end
  119.      call close(_OUTPUT)
  120.      end
  121.     end
  122.    end
  123.   end
  124.  end
  125.  
  126. /*
  127. ** If the script gets this far, then a search has been performed
  128. */
  129.  
  130. if _hits = 0 then do
  131.  if rtezrequest(_nohitsstring,"Doh!","Finished (in "||time(e)||" seconds)",_def1) then do
  132.   address command
  133.   'Sys:c/delete "'||_SearchOut||'" FORCE QUIET'
  134.   exit(0)
  135.   end
  136.  end
  137. else do
  138.  _endsearchstring = "Your search turned up "||_hits||" hit(s)!"
  139.  if rtezrequest(_endsearchstring,"_Show me!|_Big deal.","Finished (in "||time(e)||" seconds)",_def1) = 1 then do
  140.   address command
  141.   _viewcmd||' "'||_SearchOut||'"'
  142.   exit(0)
  143.   end
  144.  else do
  145.   address command
  146.   'c:delete "'||_SearchOut||'" FORCE QUIET'
  147.   exit(0)
  148.   end
  149.  end
  150.  
  151.